<!DOCTYPE HTML>
<html style="font-size: 50px;">
<head>
    <meta charset="utf-8">
    <meta name="viewport"
          content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>title</title>
    <link rel="stylesheet" type="text/css" href="../css/myui.css"/>
    <link rel="stylesheet" type="text/css" href="../css/hui.css"/>
    <style type="text/css">
        #fenx {
            font-weight: bold;
            width: 95%;
            margin: 0px auto;
            background: #fffae7;
            text-align: center;
            font-size: 16px;
            display: none;
        }

        #div1 {
            float: left;
            display: inline-block;
            width: 22%;
            text-align: center;
            margin: 5px;
        }

        #div2 {
            float: left;
            display: inline-block;
            width: 22%;
            text-align: center;
            margin: 5px;
        }

        #div3 {
            float: right;
            display: inline-block;
            width: 22%;
            text-align: center;
            margin: 5px;
        }

        #div4 {
            float: right;
            display: inline-block;
            width: 22%;
            text-align: center;
            margin: 5px;
        }
        .sp-content .rule {
            padding-top: 0.1rem;
        }
        .numb{
            color: red;
            /*text-align: left;*/
            font-weight: bold;
            font-size: 13px;
        }
        .btnfz{
            background-color: #0b97c4;
            border-radius: 5px;
            font-size: 13px;
            font-weight: bold;
            width: 60px;
            padding: 2px;
            color: yellow;
        }
        td{
            padding: 5px;
        }
    </style>
</head>
<body style="background-color:#fffae4">
<div class="">
    <img src="../image/share_bg.png" alt="" width="100%">
</div>

<div class="sp-content">

    <div class="bigImg">
        <div class="getVip">
            <!--  <button onclick="erweima()">获取二维码</button>-->
            <button onclick="Schb()">生成海报</button>

            <button onclick="copySet()" id="btn2">邀请好友</button>
        </div>
    </div>

    <div id="fenx">
        <div id="div1">
            <img src="../image/wx.png" id="wxfx" onclick="sharefx()">
            微信分享
        </div>
        <div id="div2">
            <img src="../image/qq.png" id="qqx" onclick="sharefx()">
            QQ分享
        </div>
        <div id="div4">
            <img src="../image/lianj.png" id="lianj" onclick="fenxlianj()">
            复制链接
        </div>
        <div id="div3">
            <img src="../image/weibo.png" id="wbo" onclick="sharefx()">
            微博分享
        </div>
    </div>
    <div class="rule">
        <h3>
            <p style="color: blue;">推广数据</p>
        </h3>
        <br>
        <table border="1" width="100%"  style="text-align: center" cellpadding="0" cellspacing="0">
            <tr>
                <td>我的邀请码</td>
                <td class="numb" id="share_ma">加载中...</td>
                <td><button class="btnfz" type="button" onclick="copyShare()">复制</button></td>
            </tr>
            <tr>
                <td>我的余额</td>
                <td class="numb" id="moneys">加载中...</td>
                <td><button class="btnfz" type="button" onclick="tixian()">提现</button></td>
            </tr>
            <tr>
                <td>已提现</td>
                <td class="numb" id="ok_moneys">加载中...</td>
                <td><button class="btnfz" type="button" onclick="tixianod()">提现明细</button></td>
            </tr>
            <tr>
                <td>我的积分</td>
                <td class="numb" id="sign">加载中...</td>
                <td><button class="btnfz" type="button" onclick="yaoqin_p('yaoqingp')">查看明细</button></td>
            </tr>
            <tr>
                <td>邀请数据</td>
                <td class="numb" id="yaoqing_num">加载中...</td>
                <td><button class="btnfz" type="button" onclick="yaoqin_p('yaoqingp')">查看数据</button></td>
            </tr>
            <tr>
                <td>最低提现额</td>
                <td class="numb" id="tixian">加载中...</td>
                <td>--</td>
            </tr>
            <tr>
                <td>支付宝</td>
                <td class="numb" id="zfb">加载中...</td>
                <td><button class="btnfz" onclick="setZfb()" type="button">设置</button></td>
            </tr>
        </table>

        <h3>
            <p style="color: blue;">活动规则</p>
        </h3>
        <ul>
            <li>在本页面复制邀请链接或二维码发送给微信或QQ好友，好友注册可获得积分哦</li>
            <li>好友使用链接后您将获得对应积分（代理分享可绑定下级）,享受多级分销提成</li>
            <li>在获取积分后您可以在APP个人中心，使用积分兑换现金或者兑换VIP时长</li>
            <li>兑换的现金达到平台指定的提现额度，可以提到自己的支付宝哦</li>
            <li>每天坚持签到，签到可以获得积分</li>
        </ul>
        <br>
    </div>

</div>

</body>
<script src="../script/hui.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" src="../script/api.js"></script>
<script type="text/javascript">
    var api_url = localStorage.getItem('api_url');
    var copy = '';
    var shama = '';
    var fenx1 = '';
    apiready = function () {
        api.ajax({
            url: api_url + '/login/login/share2.html',
            method: 'get',
            data: {
                values: {
                    uid: localStorage.getItem('user_id'),
                    mike_key: localStorage.getItem('mike_key')
                }
            }
        }, function (ret, err) {
            if (ret) {
                copy = ret.msg.yaoqing_url;
                shama = ret.msg.share_ma;
                moneys_u = ret.msg.moneys;
                tixian_u = ret.msg.tixian;

                var share_ma = $api.byId('share_ma');
                share_ma.innerHTML = ret.msg.share_ma;

                var moneys = $api.byId('moneys');
                moneys.innerHTML = ret.msg.moneys + '元';

                var ok_moneys = $api.byId('ok_moneys');
                ok_moneys.innerHTML = ret.msg.ok_moneys + '元';

                var sign = $api.byId('sign');
                sign.innerHTML = ret.msg.sign + '个';

                var yaoqing_num = $api.byId('yaoqing_num');
                yaoqing_num.innerHTML = ret.msg.yaoqing_num + '个';

                var tixian = $api.byId('tixian');
                tixian.innerHTML = ret.msg.tixian + '元';

                var zfb = $api.byId('zfb');
                zfb.innerHTML = ret.msg.zfb;

                api.hideProgress();

            } else {
                alert('获取链接失败');

            }
        });

    }

    function yaoqin_p(name) {
        //普通用户登录检测
        api.ajax({
            url: api_url + '/login/login/checklogin',
            method: 'POST',
            data: {
                values: {
                    username: localStorage.getItem('user_name'),
                    passwd: localStorage.getItem('password'),
                }
            }
        }, function (ret, err) {
            if (ret) {
                if (ret.code == 0) {
                    api.toast({
                        msg: '验证失败',
                        duration: 2000
                    });
                    return;
                } else if (ret.code == 1) {
                    api.toast({
                        msg: '验证成功 正在登录',
                        duration: 2000
                    });
                    api.openWin({
                        name: 'daili_guanli_win',
                        url: './daili_guanli_win.html',
                        delay: 100,
                        pageParam: {
                            url: 'http://124.222.162.204:1002/login/login/'+name+'.html?uid='+localStorage.getItem('user_id')+'&mike_key='+localStorage.getItem('mike_key')
                        },
                        bgColor: 'rgba(0,0,0,0)'
                    });
                }
            } else {
                api.toast({
                    msg: '(温馨提醒您！  网络错误 请检查！)',
                    duration: 5000
                });
                return;
            }
        });
    }
    function tixianod() {
        //普通用户登录检测
        api.ajax({
            url: api_url + '/login/login/checklogin',
            method: 'POST',
            data: {
                values: {
                    username: localStorage.getItem('user_name'),
                    passwd: localStorage.getItem('password'),
                }
            }
        }, function (ret, err) {
            if (ret) {
                if (ret.code == 0) {
                    api.toast({
                        msg: '验证失败',
                        duration: 2000
                    });
                    return;
                } else if (ret.code == 1) {
                    api.toast({
                        msg: '验证成功 正在登录',
                        duration: 2000
                    });
                    api.openWin({
                        name: 'daili_guanli_win',
                        url: './daili_guanli_win.html',
                        delay: 100,
                        pageParam: {
                            url: 'http://124.222.162.204:1002/login/login/tixianorder.html?uid='+localStorage.getItem('user_id')+'&mike_key='+localStorage.getItem('mike_key')
                        },
                        bgColor: 'rgba(0,0,0,0)'
                    });
                }
            } else {
                api.toast({
                    msg: '(温馨提醒您！  网络错误 请检查！)',
                    duration: 5000
                });
                return;
            }
        });
    }
    function copyShare() {
        var clipBoard = api.require('clipBoard');
        clipBoard.set({
            value: shama
        }, function (ret, err) {
            if (ret) {
                alert('复制成功');
                api.hideProgress();
            } else {

            }
        });
    }
    function tixian() {
        var delay = 0;
        if (api.systemType != 'ios') {
            delay = 300;
        }
        api.openWin({
            name: 'tixian_win',
            url: 'tixian_win.html',
            bounces: false,
            delay: delay,
            slidBackEnabled: true,
            vScrollBarEnabled: false,
            pageParam: {},
            bgColor: '#000000'
        });
    }
    function setZfb() {
        var dialogBox = api.require('dialogBox');
        dialogBox.list({
            tapClose: true,
            texts: {
                title: '设置支付宝',
                enter: '提交'
            },
            listTitles: ['姓名：', '支付宝：'],
            styles: {
                bg: '#fff',
                corner: 10,
                w: 300,
                h: 260,
                title: {
                    h: 44,
                    size: 14,
                    color: '#000'
                },
                list: {
                    h: 128,
                    row: 2,
                    title: {
                        marginL: 10,
                        size: 14,
                        color: '#696969'
                    },
                    content: {
                        marginL: 10,
                        size: 14,
                        color: '#000'
                    }
                },
                dividingLine: {
                    width: 0.5,
                    color: '#696969'
                },
                enter: {
                    bg: 'rgba(0,0,0,0)',
                    color: '#007FFF',
                    size: 12,
                    h: 40
                }
            }
        }, function(ret) {
            if (ret.eventType == 'enter') {
                var zfb=ret.amounts
                if(zfb[0]==null||zfb[0]==''||zfb[1]==null||zfb[1]==''){
                    api.alert({
                        msg: '！不能为空！',
                        duration: 3000
                    });
                    return;
                }
                api.ajax({
                    url: api_url + '/login/login/setzfb.html',
                    method: 'get',
                    data: {
                        values: {
                            uid: localStorage.getItem('user_id'),
                            mike_key: localStorage.getItem('mike_key'),
                            zfb:zfb
                        }
                    }
                }, function (data, err) {
                    if (data) {
                        if (data.code == 1) {
                            api.alert({
                                msg: '设置成功'
                            });
                            api.hideProgress();
                            var zfb = $api.byId('zfb');
                            zfb.innerHTML =data.zfb;
                            var dialogBox = api.require('dialogBox');
                            dialogBox.close({
                                dialogName: 'list'
                            });
                        }else{
                            api.alert({
                                msg: data.msg
                            });
                        }
                    } else {
                        alert('网络异常');

                    }
                });

            }
        });
    }
    function erweima() {
        var dialogBox = api.require('dialogBox');
        dialogBox.webView({
            tapClose: false,
            path: 'http://qr.topscan.com/api.php?text=' + copy,
            texts: {
                title: '专属二维码',
                leftBtnTitle: '取消',
                rightBtnTitle: '保存'
            },
            styles: {
                bg: '#fff',
                corner: 5,
                w: 300,
                h: 380,
                title: {
                    h: 44,
                    size: 14,
                    color: '#000'
                },
                upDividingLine: {
                    width: 0.2,
                    color: '#696969'
                },
                webView: {
                    h: 300,
                    bg: '#fff',
                },
                downDividingLine: {
                    width: 0.2,
                    color: '#696969'
                },
                left: {
                    bg: 'rgba(0,0,0,0)',
                    color: '#007FFF',
                    size: 12
                },
                right: {
                    bg: 'rgba(0,0,0,0)',
                    color: '#007FFF',
                    size: 12
                }
            }
        }, function (ret) {
            if (ret.eventType == 'left') {
                var dialogBox = api.require('dialogBox');
                dialogBox.close({
                    dialogName: 'webView'
                });
            } else {
                alert('请截屏后分享');
            }
        });
    }
    function Schb() {

        api.openWin({
            name: 'schb',
            url: './schb.html',
            delay: 100,
            pageParam: {url: copy},
            bgColor: 'rgba(0,0,0,0)'
        });

    }
    function copySet() {
        var clipBoard = api.require('clipBoard');
        clipBoard.set({
            value: '全网VIP视频免费看，高清无广告，再也不用充值会员啦！APP下载地址：' + copy
        }, function (ret, err) {
            if (ret) {
                api.hideProgress();
            } else {

            }
        });
    }
    function fenxsj() {
        var clipBoard = api.require('clipBoard');
        clipBoard.get(function (ret, err) {
            if (ret) {
                fenx1 = ret.value;
            } else {
                alert(JSON.stringify(err));
            }
        });
    }
    function fenxlianj() {
        hui('#fenx').hide();
        var clipBoard = api.require('clipBoard');
        clipBoard.get(function (ret, err) {
            if (ret) {
                fenx1 = ret.value;
                alert('已复制!可直接粘贴发送');
            } else {
                alert(JSON.stringify(err));
            }
        });
    }
    function sharefx() {
        var sharedModule = api.require('shareAction');
        sharedModule.share({
            text: '全网VIP视频免费看，高清无广告，再也不用充值会员啦！下载地址：',
            type: 'url',
            path: copy,
            thumbnail: "widget://image/fx.png"
        });
    }
    hui('#btn2').click(function () {
        hui('#fenx').show();
        fenxsj();
    });
    function openWin(name) {
        var delay = 0;
        if (api.systemType != 'ios') {
            delay = 300;
        }
        api.openWin({
            name: '' + name + '',
            url: '' + name + '.html',
            bounces: false,
            delay: delay,
            slidBackEnabled: true,
            vScrollBarEnabled: false
        });
    }
</script>
</html>
